using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._Statistical
{
    /// <summary>
    /// <para>Focal Statistics</para>
    /// <para>Calculates for each input cell location a statistic of the values within a specified neighborhood around it.</para>
    /// <para>计算每个输入像元位置的周围指定邻域内值的统计数据。</para>
    /// </summary>    
    [DisplayName("Focal Statistics")]
    public class FocalStatistics : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public FocalStatistics()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input raster</para>
        /// <para>The raster for which the focal statistics for each input cell will be calculated.</para>
        /// <para>将计算每个输入像元的焦点统计数据的栅格。</para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output raster</para>
        /// <para>The output focal statistics raster.</para>
        /// <para>输出焦点统计栅格。</para>
        /// </param>
        public FocalStatistics(object _in_raster, object _out_raster)
        {
            this._in_raster = _in_raster;
            this._out_raster = _out_raster;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Focal Statistics";

        public override string CallName => "ia.FocalStatistics";

        public override List<string> AcceptEnvironments => ["autoCommit", "cellSize", "cellSizeProjectionMethod", "compression", "configKeyword", "extent", "geographicTransformations", "mask", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _out_raster, _neighborhood, _statistics_type.GetGPValue(), _ignore_nodata.GetGPValue(), _percentile_value];

        /// <summary>
        /// <para>Input raster</para>
        /// <para>The raster for which the focal statistics for each input cell will be calculated.</para>
        /// <para>将计算每个输入像元的焦点统计数据的栅格。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output raster</para>
        /// <para>The output focal statistics raster.</para>
        /// <para>输出焦点统计栅格。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Neighborhood</para>
        /// <para><xdoc>
        ///   <para>The cells surrounding a processing cell that will be used in the statistic calculation. There are several predefined neighborhood types to choose from, or a custom kernel can be defined.</para>
        ///   <para>Once the neighborhood type is selected, other parameters can be set to fully define the shape, size, and units of measure. The default neighborhood is a square rectangle with a width and height of three cells.</para>
        ///   <para>The following are the forms of the available neighborhood types:</para>
        ///   <bulletList>
        ///     <bullet_item>Annulus, Inner radius, Outer radius, Units type
        ///     <para>A torus (donut-shaped) neighborhood defined by an inner radius and an outer radius. The default annulus is an inner radius of one cell and an outer radius of three cells.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Circle, Radius, Units type
        ///     <para>A circular neighborhood with the given radius. The default radius is three cells.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Rectangle, Height, Width, Units type
        ///     <para>A rectangular neighborhood defined by height and width. The default is a square with a height and width of three cells.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Wedge, Radius, Start angle, End angle, Units type
        ///     <para>A wedge-shaped neighborhood defined by a radius, the start angle, and the end angle. The wedge extends counterclockwise from the starting angle to the ending angle. Angles are specified in degrees, with 0 or 360 representing east. Negative angles can be used. The default wedge is from 0 to 90 degrees, with a radius of three cells.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Irregular, Kernel file
        ///     <para>A custom neighborhood with specifications set by the identified kernel text file.</para>
        ///     </bullet_item><para/>
        ///     <bullet_item>Weight, Kernel file
        ///     <para>A custom neighborhood with specifications set by the identified kernel text file, which can apply weights to the members of the neighborhood.</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   <para>For the annulus, circle, rectangle and wedge neighborhood types, the distance units for the parameters can be specified in Cell units or Map units. Cell units is the default.</para>
        ///   <para>For kernel neighborhoods, the first line in the kernel file defines the width and height of the neighborhood in numbers of cells. The subsequent lines indicate how the input value that corresponds to that location in the kernel will be processed. A value of 0 in the kernel file for either the irregular or the weight neighborhood type indicates the corresponding location will not be included in the calculation. For the irregular neighborhood, a value of 1 in the kernel file indicates that the corresponding input cell will be included in the operation. For the weight neighborhood, the value at each position indicates what the corresponding input cell value is to be multiplied by. Positive, negative, and decimal values can be used.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于统计计算的处理单元格周围的单元格。有几种预定义的邻域类型可供选择，或者可以定义自定义内核。</para>
        ///   <para>选择邻域类型后，可以设置其他参数以完全定义形状、大小和度量单位。默认邻域是一个宽高为三个像元的方形矩形。</para>
        ///   <para>以下是可用邻域类型的形式：</para>
        ///   <bulletList>
        /// <bullet_item>环形， 内半径， 外半径， 单位类型
        ///     <para>由内半径和外半径定义的环面（甜甜圈形）邻域。默认环形是一个像元的内半径和三个像元的外半径。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>圆、半径、单位类型
        ///     <para>具有给定半径的圆形邻域。默认半径为三个像元。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>矩形、高度、宽度、单位类型
        ///     <para>由高度和宽度定义的矩形邻域。默认值为高度和宽度为三个单元格的正方形。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>楔块、半径、起始角度、端角、单位类型
        ///     <para>由半径、起始角和结束角定义的楔形邻域。楔块从起始角逆时针延伸到结束角。角度以度为单位指定，0 或 360 表示东。可以使用负角。默认楔块为 0 到 90 度，半径为 3 个像元。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>不规则的内核文件
        ///     <para>具有由标识的内核文本文件设置的规范的自定义邻域。</para>
        ///     </bullet_item><para/>
        /// <bullet_item>权重、内核文件
        ///     <para>具有由标识的内核文本文件设置规范的自定义邻域，该文件可以将权重应用于邻域的成员。</para>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   <para>对于环形、圆形、矩形和楔形邻域类型，可以在像元单位或地图单位中指定参数的距离单位。单元单位是默认值。</para>
        ///   <para>对于内核邻域，内核文件中的第一行定义邻域的宽度和高度（以单元格数为单位）。后续行指示如何处理与内核中该位置相对应的输入值。不规则邻域类型或权重邻域类型的内核文件中的值为 0 表示相应位置将不包括在计算中。对于不规则邻域，内核文件中的值为 1 表示相应的输入单元将包含在操作中。对于权重邻域，每个位置的值表示相应的输入像元值要乘以多少。可以使用正值、负值和十进制值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Neighborhood")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _neighborhood { get; set; } = null;


        /// <summary>
        /// <para>Statistics type</para>
        /// <para><xdoc>
        ///   <para>Specifies the statistic type to be calculated.</para>
        ///   <bulletList>
        ///     <bullet_item>Mean—The mean (average value) of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///     <bullet_item>Majority—The majority (value that occurs most often) of the cells in the neighborhood will be identified.</bullet_item><para/>
        ///     <bullet_item>Maximum—The maximum (largest value) of the cells in the neighborhood will be identified.</bullet_item><para/>
        ///     <bullet_item>Median—The median of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///     <bullet_item>Minimum—The minimum (smallest value) of the cells in the neighborhood will be identified.</bullet_item><para/>
        ///     <bullet_item>Minority—The minority (value that occurs least often) of the cells in the neighborhood will be identified.</bullet_item><para/>
        ///     <bullet_item>Percentile—A percentile of the cells in the neighborhood will be calculated. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the Percentile value parameter.</bullet_item><para/>
        ///     <bullet_item>Range—The range (difference between largest and smallest value) of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///     <bullet_item>Sum—The sum of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///     <bullet_item>Variety—The variety (the number of unique values) of the cells in the neighborhood will be calculated.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>The default statistic type is Mean.</para>
        ///   <para>If the input raster is integer, all the statistics types are available. If the input raster is floating point, only the Mean, Maximum, Median, Minimum, Percentile, Range, Standard deviation, and Sum statistic types are available.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要计算的统计信息类型。</para>
        ///   <bulletList>
        ///     <bullet_item>均值—将计算邻域中像元的平均值（平均值）。</bullet_item><para/>
        ///     <bullet_item>多数—将识别邻域中像元的大多数（最常出现的值）。</bullet_item><para/>
        ///     <bullet_item>最大值—将标识邻域中像元的最大值（最大值）。</bullet_item><para/>
        ///     <bullet_item>中位数—将计算邻域中像元的中位数。</bullet_item><para/>
        ///     <bullet_item>最小值—将标识邻域中像元的最小值（最小值）。</bullet_item><para/>
        ///     <bullet_item>少数 - 将识别邻域中像元的少数（出现频率最低的值）。</bullet_item><para/>
        ///     <bullet_item>百分位数—将计算邻域中像元的百分位数。默认情况下计算第 90 个百分位数。您可以使用百分位数值参数指定其他值（从 0 到 100）。</bullet_item><para/>
        ///     <bullet_item>范围—将计算邻域中像元的范围（最大值和最小值之间的差值）。</bullet_item><para/>
        ///     <bullet_item>标准差—将计算邻域中像元的标准差。</bullet_item><para/>
        ///     <bullet_item>总和—将计算邻域中像元的总和。</bullet_item><para/>
        ///     <bullet_item>多样性—将计算邻域中像元的多样性（唯一值的数量）。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>默认统计类型为 Mean。</para>
        ///   <para>如果输入栅格为整数，则所有统计数据类型均可用。如果输入栅格为浮点型，则只有平均值、最大值、中位数、最小值、百分位数、范围、标准差和总和统计数据类型可用。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Statistics type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _statistics_type_value _statistics_type { get; set; } = _statistics_type_value._MEAN;

        public enum _statistics_type_value
        {
            /// <summary>
            /// <para>Mean</para>
            /// <para>Mean—The mean (average value) of the cells in the neighborhood will be calculated.</para>
            /// <para>均值—将计算邻域中像元的平均值（平均值）。</para>
            /// </summary>
            [Description("Mean")]
            [GPEnumValue("MEAN")]
            _MEAN,

            /// <summary>
            /// <para>Majority</para>
            /// <para>Majority—The majority (value that occurs most often) of the cells in the neighborhood will be identified.</para>
            /// <para>多数—将识别邻域中像元的大多数（最常出现的值）。</para>
            /// </summary>
            [Description("Majority")]
            [GPEnumValue("MAJORITY")]
            _MAJORITY,

            /// <summary>
            /// <para>Maximum</para>
            /// <para>Maximum—The maximum (largest value) of the cells in the neighborhood will be identified.</para>
            /// <para>最大值—将标识邻域中像元的最大值（最大值）。</para>
            /// </summary>
            [Description("Maximum")]
            [GPEnumValue("MAXIMUM")]
            _MAXIMUM,

            /// <summary>
            /// <para>Median</para>
            /// <para>Median—The median of the cells in the neighborhood will be calculated.</para>
            /// <para>中位数—将计算邻域中像元的中位数。</para>
            /// </summary>
            [Description("Median")]
            [GPEnumValue("MEDIAN")]
            _MEDIAN,

            /// <summary>
            /// <para>Minimum</para>
            /// <para>Minimum—The minimum (smallest value) of the cells in the neighborhood will be identified.</para>
            /// <para>最小值—将标识邻域中像元的最小值（最小值）。</para>
            /// </summary>
            [Description("Minimum")]
            [GPEnumValue("MINIMUM")]
            _MINIMUM,

            /// <summary>
            /// <para>Minority</para>
            /// <para>Minority—The minority (value that occurs least often) of the cells in the neighborhood will be identified.</para>
            /// <para>少数 - 将识别邻域中像元的少数（出现频率最低的值）。</para>
            /// </summary>
            [Description("Minority")]
            [GPEnumValue("MINORITY")]
            _MINORITY,

            /// <summary>
            /// <para>Percentile</para>
            /// <para>Percentile—A percentile of the cells in the neighborhood will be calculated. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the Percentile value parameter.</para>
            /// <para>百分位数—将计算邻域中像元的百分位数。默认情况下计算第 90 个百分位数。您可以使用百分位数值参数指定其他值（从 0 到 100）。</para>
            /// </summary>
            [Description("Percentile")]
            [GPEnumValue("PERCENTILE")]
            _PERCENTILE,

            /// <summary>
            /// <para>Range</para>
            /// <para>Range—The range (difference between largest and smallest value) of the cells in the neighborhood will be calculated.</para>
            /// <para>范围—将计算邻域中像元的范围（最大值和最小值之间的差值）。</para>
            /// </summary>
            [Description("Range")]
            [GPEnumValue("RANGE")]
            _RANGE,

            /// <summary>
            /// <para>Standard deviation</para>
            /// <para>Standard deviation—The standard deviation of the cells in the neighborhood will be calculated.</para>
            /// <para>标准差—将计算邻域中像元的标准差。</para>
            /// </summary>
            [Description("Standard deviation")]
            [GPEnumValue("STD")]
            _STD,

            /// <summary>
            /// <para>Sum</para>
            /// <para>Sum—The sum of the cells in the neighborhood will be calculated.</para>
            /// <para>总和—将计算邻域中像元的总和。</para>
            /// </summary>
            [Description("Sum")]
            [GPEnumValue("SUM")]
            _SUM,

            /// <summary>
            /// <para>Variety</para>
            /// <para>Variety—The variety (the number of unique values) of the cells in the neighborhood will be calculated.</para>
            /// <para>多样性—将计算邻域中像元的多样性（唯一值的数量）。</para>
            /// </summary>
            [Description("Variety")]
            [GPEnumValue("VARIETY")]
            _VARIETY,

        }

        /// <summary>
        /// <para>Ignore NoData in calculations</para>
        /// <para><xdoc>
        ///   <para>Specifies whether NoData values will be ignored by the statistic calculation.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—If a NoData value exists within a neighborhood, the NoData value will be ignored. Only cells within the neighborhood that have data values will be used in determining the output value. This means that if the processing cell value is NoData, the processing cell may receive a value in the output raster if this parameter is checked, provided at least one cell within the neighborhood has a valid value. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—If any cell in a neighborhood has a value of NoData, including the processing cell, the output for the processing cell will be NoData. If this parameter is not checked, the presence of a NoData value implies that there is insufficient information to determine the statistic value for the neighborhood.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定统计计算是否忽略 NoData 值。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 如果邻域中存在 NoData 值，则将忽略该 NoData 值。只有邻域中具有数据值的像元才会用于确定输出值。这意味着，如果处理像元值为 NoData，则如果选中此参数，则处理像元可能会在输出栅格中接收到一个值，前提是邻域中至少有一个像元具有有效值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 如果邻域中的任何像元（包括处理像元）的值为 NoData，则处理像元的输出将为 NoData。如果未选中此参数，则存在 NoData 值意味着没有足够的信息来确定邻域的统计值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ignore NoData in calculations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _ignore_nodata_value _ignore_nodata { get; set; } = _ignore_nodata_value._true;

        public enum _ignore_nodata_value
        {
            /// <summary>
            /// <para>DATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DATA")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NODATA</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NODATA")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Percentile value</para>
        /// <para><xdoc>
        ///   <para>The percentile to calculate. The default is 90, for the 90th percentile.</para>
        ///   <para>The values can range from 0 to 100. The 0th percentile is essentially equivalent to the Minimum statistic, and the 100th percentile is equivalent to Maximum. A value of 50 will produce essentially the same result as the Median statistic.</para>
        ///   <para>This option is only supported if the Statistics type parameter is set to Percentile. If any other statistics type has been specified, this parameter will be ignored.
        ///   <bold></bold>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要计算的百分位数。默认值为 90，表示第 90 个百分位数。</para>
        ///   <para>这些值的范围可以从 0 到 100。第 0 个百分位数基本等于最小统计量，第 100 个百分位数等效于最大值。值为 50 将产生与中位数统计量基本相同的结果。</para>
        /// <para>仅当统计信息类型参数设置为百分位数时，才支持此选项。如果指定了任何其他统计信息类型，则将忽略此参数。
        ///   <bold></bold>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Percentile value")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _percentile_value { get; set; } = 90;


        public FocalStatistics SetEnv(int? autoCommit = null, object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object mask = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, mask: mask, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}